package HomeWork1;

public class Test {
    public static void main(String[] args) {
        Animal[] animals=new Animal[5];
        animals[0]=new Dog("罗小黑",4,"黑色");
        animals[1]=new Dog("大黄",3,"黄色");
        animals[2]=new Chick("坤坤",4,"灰色");
        animals[3]=new Fish("大禹",50,"黄色");
        animals[4]=new Fish("若治",40,"紫色");
        for (int i = 0; i <animals.length ; i++) {
            System.out.println(animals[i].name);
            animals[i].eat();
            animals[i].drink();
            if (animals[i] instanceof Dog){
                Dog dog=(Dog)animals[i];
                dog.lookHome();
                dog.swim();
            }
            if (animals[i] instanceof Chick){
                Chick chick=(Chick)animals[i];
                chick.layEggs();
            }
        }
        Master master=new Master();
        Dog d=new Dog("罗小黑",4,"黑色");
        Fish f=new Fish("大禹",50,"黄色");
        Chick c=new Chick("坤坤",4,"灰色");
        master.feed(d);
        master.feed(f);
        master.feed(c);
    }
}
